<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增外部用户')" />
	<th:block th:include="include :: select2-css" />
</head>
<body>
    <div class="main-content">
        <form id="form-user-add" class="form-horizontal">
            <h4 class="form-header h4">基本信息</h4>
            <div class="row">
            	<div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">姓名：</label>
                        <div class="col-sm-8">
                            <input name="name" placeholder="请输入用户名称" class="form-control" type="text" maxlength="30" required>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">归属用户：</label>
                        <div class="col-sm-8">
                            <div class="input-group">
                                <input class="form-control" type="hidden" name="followerUserId"  id="followerUserId" required>
                                <input class="form-control" type="text" name="followerUserName" onclick="selectUserInfo()"  id="followerUserName"  required>
                                <span class="input-group-addon"><i class="fa fa-search"></i></span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">手机号码：</label>
                        <div class="col-sm-8">
                            <div class="input-group">
                                <input id="mobile" name="mobile" placeholder="请输入手机号码" class="form-control" type="text" maxlength="11" required>
                                <span class="input-group-addon"><i class="fa fa-mobile"></i></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">邮箱：</label>
                        <div class="col-sm-8">
                            <div class="input-group">
                                <input id="email" name="email" class="form-control email" type="text" maxlength="20" placeholder="请输入邮箱" required>
                                <span class="input-group-addon"><i class="fa fa-envelope"></i></span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-sm-4 control-label is-required">企业名称：</label>
                        <div class="col-sm-8">
                            <input id="companyName" name="companyName"  class="form-control" type="text" placeholder="请输入企业名称" required>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        <label class="col-xs-4 control-label is-required">岗位：</label>
                        <div class="col-xs-8">
                            <input id="title" name="title" class="form-control" type="text" maxlength="20" placeholder="请输入岗位" required>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row">
                <div class="col-sm-12">
                <div class="form-group">
                    <label class="col-sm-2 control-label is-required">地址：</label>
                    <div class="col-sm-8">
                        <input id="address" name="address" class="form-control" type="text" maxlength="120" placeholder="请输入地址" required>
                    </div>
                </div>
                </div>
            </div>
            <h4 class="form-header h4">其他信息</h4>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label">标签：</label>
                        <div class="col-xs-10">
                            <div class="row" th:each="dict : ${label}">
                                <label class="col-xs-2 control-label" th:text="${dict.name}"></label>
                                <div class="radio-box" th:each="label : ${dict.labels}">
                                    <input type="radio" th:id="${'faqType_' + label.id}" name="labelIds" th:value="${label.id}">
                                    <label th:for="${'faqType_' + label.id}" th:text="${label.name}"></label>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="form-group">
                        <label class="col-xs-2 control-label">备注：</label>
                        <div class="col-xs-10">
                            <textarea name="remark" maxlength="500" class="form-control" rows="3"></textarea>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
      
    <div class="row">
        <div class="col-sm-offset-5 col-sm-10">
            <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>&nbsp;
            <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
        </div>
    </div>
	<th:block th:include="include :: footer" />
	<th:block th:include="include :: select2-js" />
	<script>
	    var prefix = ctx + "ding/extContactUser";
        
        function submitHandler() {
	        if ($.validate.form()) {
	        	var data = $("#form-user-add").serializeArray();
	        	$.operate.saveTab(prefix + "/add", data);
	        }
	    }
        function selectUserInfo() {
            var url = "/system/dept/selectUser/0";
            $.modal.open("选择用户",url,"","",doSubmitOne);
        }

        function doSubmitOne(index, layero){
            var body = layer.getChildFrame('body', index);
            var iframeWin = layero.find('iframe')[0];
            iframeWin.contentWindow.submitHandler(index, layero);
            $("#followerUserId").val(body.find('#dingUserId').val());
            $("#followerUserName").val(body.find('#userName').val());
            layer.close(index);
        }
    </script>
</body>
</html>